<?php
namespace Index\Controller;
use Think\Controller;
use Think\Page;
class IndexController extends Controller {
    public function index(){
        $s = M('wenti');
        $dx =  $s->count();
        $pga = new Page($dx,5);
        $show = $pga->show();
        $m = M();
        $sql = "SELECT s.*,u.user_name,u.avatarulr FROM wenti s JOIN USER u ON s.sid = u.id ORDER BY tim desc limit {$pga->firstRow},{$pga->listRows};";
        $ret = $m->query($sql);
        //热门用户
//        $sql = ""
        $this->assign('show', $show);
        $this->assign('ret', $ret);
        $this->display('index');
    }
    public function esc(){
        session_unset();
        session_destroy();
        $this->success('退出成功',U("Index/index"),2);
    }
}